#List的create
l = [{'a': 1}]
print(l)
l.append((1,))
print(l)
l += [{'a', 'b'}]
print(l)
l *= 2
print(l)
l.insert(3, '分割一下')
print(l)
#List的retrieve
print(l[3])
print(l[0:3])
print(l[-1])
print(l[0:len(l):1])
#List的update
l[3] = ['分割一下下']
print(l)
l[0:3]='换头部'
print(l)
l.pop()
print(l)
l.clear()
print(l)
#List的排序
l = ['b', 'a', 'd', 'c']
l.sort()
print(l)
l.reverse()
print(l)
sorted(l)
print(l)

#tuple(不可更改，所以只能查)
t = (1, 2)
print(t[1])

#dict的create
d = {'a': 1}
print(d)
d['b'] = 2
print(d)
d2 = {'c': 3}
d.update(d2)
print(d)
d.setdefault('a', 0)
d.setdefault('d', 0)
print(d)
#dict的retrieve
print(d['a'])
print(d.get('e', -1))
print(list(d.keys()))
print(list(d.values()))
print(d.items())
#dict的update
d.update({'a': 0,'e': 4})
print(d)
#dict的delete
d.pop('e')
print(d)
d.popitem()
print(d)
d.clear()
print(d)

#set的create
s = {'a'}
print(s)
s.add('b')
print(s)
s.update('c')
print(s)
#set的retrieve
print('a' in s)
#set的update
s_1 = {'d'}
s_2 = s.union(s_1)
print(s)
print(s_2)
#set的delete
# s.remove('a')
# print(s)
s.discard('b')
print(s)
s.pop()
print(s)